home *** CD-ROM | disk | FTP | other *** search
/ Shareware Grab Bag / Shareware Grab Bag.iso / 090 / cmln0385.arc / DDRIVER2.LTG < prev    next >
Text File  |  1986-02-27  |  2KB  |  67 lines

  1.  
  2. D Driver listing 2
  3.  
  4.  
  5. IOCTL.ASM
  6.  
  7. ;PERFORM IOCTL CALL FOR C MAIN PROGRAMS
  8. ;(c) Copyright 1984 by The Computer Entomologist
  9. ;
  10. ;    Permission is hereby granted to use or distribute 
  11. ;this software withou⌠ an∙ restrictions«  Yo⌡ ma∙ includσ
  12. ;i⌠ iε an∙ hardwarσ o≥ softwarσ produc⌠ tha⌠ you sell for 
  13. ;profit.
  14. ;
  15. ;    This software is distributed as is, and is not 
  16. ;guaranteed to work on any particular hardware/software 
  17. ;configuration.  Furthermore, no liability is granted with 
  18. ;this software: the user takes responsibility for any 
  19. ;damage this software may do to his system.
  20. ;
  21. ;    If you have any questions about this software, you
  22. ;can reach me at the address below.  If you implement any 
  23. ;new features or find (and fix!) any bugs, I would be happy 
  24. ;to hear from you.
  25. ;
  26. ;    Mike Higgins
  27. ;    The Computer Entomologist
  28. ;    P.O. Box 197
  29. ;    Duncans Mills, CA 95430
  30.  
  31. PUBLIC    IOCTL    ;(ASYNC,BUF,LEN,FUNC)
  32.  
  33. @CODE    SEGMENT    PUBLIC 'CODE'
  34.     ASSUME    CS:@CODE
  35.  
  36. IOCTL    PROC    NEAR
  37. ;ARGUMENTS:
  38. ASYNC=4    ;ADDRESS OF ASCIZ DEVICE NAME.
  39. BUF=6    ;ADDRESS OF A BUFFER TO READ/WRITE FROM
  40. LEN=8    ;THE NUMBER OF BYTES IN BUFFER
  41. FUNC=10    ;2 FOR IOCTL READ, 3 FOR IOCTL WRITE
  42.                                                     
  43.     PUSH    BP        ;DO THE NORMAL C LINKAGE
  44.     MOV    BP,SP
  45.  
  46.     MOV    DX,ASYNC[BP]  ;GET NAME OF DEVICE TO OPEN
  47.     MOV    AX,03D02H     ;OPEN IT FOR READ/WRITE.
  48.     INT    021H          ;WELL, CAN DOS DO IT?
  49.  
  50.     MOV    BX,AX          ;STORE HANDLE IN BX
  51.     MOV    DX,BUF[BP]    ;GET BUFFER ADDRESS
  52.     MOV    CX,LEN[BP]    ;AND LENGTH.
  53.     MOV    AX,FUNC[BP]   ;GET FUNCTION REQUESTED,
  54.     MOV    AH,68          ;TELL DOS THIS IS IOCTL CALL
  55.     INT    021H          ;WAKE UP DOS.è
  56.     MOV    AH,62          ;SET UP TO CLOSE HANDLE WHEN DONE
  57.     INT    021H          ;ASK DOS REAL NICE.
  58.  
  59.     POP    BP          ;RECOVER BP
  60.     RET              ;RETURN TO C
  61.  
  62. IOCTL    ENDP
  63.  
  64. @CODE    ENDS
  65.  
  66.     END
  67.